package com.bruce.starts.demo.xiaomage.function;

import com.google.common.collect.Maps;

import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Supplier;

/**
 * @author luotuan
 * @Description
 * @create 2021-05-26 20:41
 **/
public class SupplierDemo {
    public static void main(String[] args) {
        System.out.println(getLong().get());
        Consumer<String> consumer = System.out::println;
        Consumer<String> consumer2 = SupplierDemo::print;
        consumer2.andThen(consumer).andThen(consumer).accept("hello");
        Map<String,String> map = Maps.newHashMap();
        map.put("name","bruce");
        map.put("test","test");
        System.out.println(map.values().stream().reduce(String::concat).orElse("test"));
        Object dto = null;
        Objects.requireNonNull(dto,()->{
            throw new RuntimeException("参数错误");
        });
    }
    private static Supplier<Long> getLong(){
        return System::currentTimeMillis;
    }
   /**
    * @description: 请在此处输入方法描述信息
    * @param [ss]
    * @return: void
    * @author: luotuan
    * @date: 2021/5/27 18:17
    */
    private static void print (String ss){
        System.out.println(ss);
    }
}
